package com.xiaoxing.salesclient.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.xiaoxing.salesclient.mvp.contract.PayContract;
import com.xiaoxing.salesclient.mvp.model.entity.OrderPay;
import com.xiaoxing.salesclient.mvp.model.service.SalesService;

import javax.inject.Inject;

import io.reactivex.Observable;


@ActivityScope
public class PayModel extends BaseModel implements PayContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public PayModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<OrderPay> orderPay(String access_token, String order_no) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).orderPay(access_token, order_no);
    }

    @Override
    public Observable<OrderPay> orderPay(String access_token, String order_no, String is_staff) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).orderPay(access_token, order_no,is_staff);
    }
}